define(function () {
  var Api = {
    /**
     * 获取问卷首页列表数据
     * type: 类型(-1:所有, 0:草稿, 1:已发布, 2:已回收)
     * status: 状态(0:我发布的, 1:我参与的)
     */
    getQusetionList: function (params) {
      var reslut = null;
      var url = obpmFilePath + '/magic-api'+ qmsPath +'/questionnaires?type='+ params.type + '&status=' 
      + params.status + '&page='+ params.page + '&lines=' + params.lines + '&title=' + params.title;
      $.ajax({
        url: url,
        async: false,
        type: "GET",
        success: function (response) {
          reslut = response
        }
      });
      return reslut;
    },
    /**
     * 获取问卷首页列表数据
     */
     EditQusetion: function (id) {
      var reslut = null;
      $.ajax({
        url: obpmFilePath + '/magic-api'+ qmsPath +'/questionnaires/'+ id,
        async: false,
        type: "GET",
        success: function (response) {
          reslut = response
        }
      });
      return reslut;
    },
    /**
     * 提交问卷
     * | content          | 题目   |
        | ---------------- | ------ |
        | answer           | 答案   |
        | questionnaire_id | 问卷id |
     */
      answersSubmit: function (dataJson) {
      var reslut = null;
      $.ajax({
        url: obpmFilePath + '/magic-api'+ qmsPath +'/answers/submit',
        async: false,
        type: "POST",
        dataType: 'json',
        data: JSON.stringify(dataJson),
        contentType: 'application/json',
        success: function (response) {
          reslut = response
        }
      });
      return reslut;
    },
  }
  return Api;
})